<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('loan_mortgage_tax', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('loan_id')->comment("申请物料id");
            $table->string("company_name")->comment("公司名字");
            $table->unsignedInteger("annal_tax")->comment("年缴税");
            $table->unsignedInteger("annal_turnover")->comment("年营业额");
            $table->unsignedInteger("company_age")->comment("营业执照办理了几年");
            $table->unsignedTinyInteger("is_legal_person")->comment("是否为法人");
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `loan_mortgage_tax` comment '抵押贷款-企业税贷'");

        Schema::create('loan_mortgage_house', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('loan_id')->comment("申请物料id");
            $table->string("type", 30)->comment("房屋类型");
            $table->unsignedTinyInteger("has_certificate")->comment("是否持有房产证");
            $table->string("ownership", 30)->comment("房屋所有权");
            $table->integer("latest_estimated")->comment("房子最新评估价");
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `loan_mortgage_house` comment '抵押贷款-房屋抵押贷款'");

        Schema::create('loan_mortgage_car', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('loan_id')->comment("申请物料id");
            $table->string("info", 30)->comment("车辆信息");
            $table->unsignedInteger("car_age")->comment("购车年限");
            $table->integer("buy_price")->comment("购买裸车价");
            $table->string("car_model", 30)->comment("汽车型号");
            $table->string("car_no", 30)->comment("车牌");
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `loan_mortgage_car` comment '抵押贷款-车辆抵押贷款'");


        Schema::create('loan_credit_provident', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('loan_id')->comment("申请物料id");
            $table->string("company_name")->comment("上班公司名字全称");
            $table->string("pay_method", 30)->comment("工资发放模式");
            $table->integer("month_salary")->comment("每个月工资多少");
            $table->integer("provident_age")->comment("已购买公积金多少年");
            $table->integer("month_provident")->comment("每月公积金额度");
            $table->integer("social_insurance_age")->comment("已购买社保多少年");
            $table->integer("month_social_insurance")->comment("每个月社保缴费多少");
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `loan_credit_provident` comment '公积金信用贷款'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('loan_mortgage_tax');
        Schema::dropIfExists('loan_mortgage_house');
        Schema::dropIfExists('loan_mortgage_car');
        Schema::dropIfExists('loan_credit_provident');
    }
};
